<template>
    <div class="ma-content-block lg:flex justify-between">
      <sa-table ref="crudRef" :options="options" :columns="columns" :searchForm="searchForm">
        <template #tableSearch>
          <a-col :span="6">
            <a-form-item field="code" label="溯源码">
              <a-input allow-clear v-model="searchForm.code" placeholder="请输入" @keydown.enter="refresh" />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item field="user" label="会员信息">
                <a-input allow-clear v-model="searchForm.user" placeholder="登录名｜真实姓名" @keydown.enter="refresh" />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item field="search_num" label="第N查詢">
                <a-input allow-clear v-model="searchForm.search_num" placeholder="请输入" @keydown.enter="refresh" />
            </a-form-item>
          </a-col>
        </template>
        <!-- 状态列 -->
        <template #state="{ record }">
          <a-tag color="green" v-if="record.state == 1">{{ record.state_text }}</a-tag>
          <a-tag color="magenta" v-else>{{ record.state_text }}</a-tag>
        </template>
        <template #code="{ record }">
          <p >({{record.code_str?record.code_str:''}})</p>
        </template>
        <!-- 操作前置扩展 -->
       
      </sa-table>
    
    </div>
  </template>
  
  <script setup>
  import { onMounted, ref, reactive, computed } from 'vue'
  import AsApi from '@/api/system/afterSale'
  import SaTable from '@cps/sa-table/index.vue'
  import { Message } from '@arco-design/web-vue'
  import { throttle } from 'lodash';
  import { useRouter } from 'vue-router';

  const submitLoading = ref(false)
  const router =useRouter()
  const crudRef = ref()
  const editRef = ref()
  const operationRef =ref()
  const visible = ref(false)
  const searchForm = ref({
    code: '',
    user: '',
    search_num:'',
  })
  const options = reactive({
    api: AsApi.nfc_list,//表格数据接口
    operationColumnWidth: 200,//操作欄
    columnAlign: 'center',
    pageSimple: false,
    isExpand: false,//展開所有子樹
  })
  
  const columns = reactive([
    { title: 'ID', dataIndex: 'id', width: 100 },
  ])
  
  const refresh = async () => {
    crudRef.value?.refresh()
  }
  const getParams = async () => {
    
  }
  
  
  
  onMounted(async () => {
    getParams()
    refresh()
  })
  </script>
  
  <style scoped>
  .icon {
    width: 1em;
  }
  </style>
  